home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 12461 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.8 KB

  1. Path: csus.edu!csus
  2. From: sac46826@csus.edu (Mike Billard)
  3. Newsgroups: comp.lang.c++
  4. Subject: MFC4.0 Assertion Error- Please Help
  5. Date: Wed, 20 Mar 96 01:53:48 GMT
  6. Organization: California State University Sacramento
  7. Message-ID: <4inogo$7k1@news.csus.edu>
  8. NNTP-Posting-Host: @u0104-p03.dialin.csus.edu
  9. X-Newsreader: News Xpress 2.0 Beta #0
  10.  
  11. As a new programmer to C++ (which I like because it is not as wordy as Pascal) 
  12. I am constantly finding new tools and new problems.  My most recent problem is 
  13. quite perplexing.  I used MSVC++ 4.0 to build an SDI application and created 
  14. an edit box.  I then mapped a CEdit variable, m_Edit, to the edit control.  
  15. Next, I mapped the WM_INITDIALOG message to OnInitDialog, and in that fuction 
  16. I typed: m_Edit.SetWindowText("Default Text");
  17.  
  18.   When I run the application using the default debug mode, I get an assertion 
  19. failure on line 533 of dlgdata.cpp.  Unfortunately, it gets stranger from 
  20. here.
  21.  
  22.   If I recompile the program and run it again, I do not get the error.  
  23.  
  24.   However, if I restart my computer and run the debug-mode (and release-mode) 
  25. application, I get the same assertion error.
  26.  
  27.   Finally, If I remove the m_Edit.SetWindowText("Default Text"); line from 
  28. OnInitDialog, I do not get the error either after immediate recompilation or 
  29. after performing a system reboot.
  30.  
  31.   I can only surmise that at the point of invoking the OnInitDialog function, 
  32. the memory for the m_Edit variable is not allocated.  Is this correct?
  33.  
  34.   Since my goal is to have the dialog box display some default text in its 
  35. edit box, how can I set up the default text at run-time without obtaining this 
  36. assertion failure?  Do I need to set up the variables using a different 
  37. function?
  38.  
  39.   Thanks for your help.
  40.  
  41. Sincerely, 
  42. Mike Billard
  43. billardm@csus.edu
  44.  
  45. -Mike Billard
  46.  
  47. email: billardm@csus.edu
  48.